package GUI;

import processing.core.PImage;


public class PlusButton extends Component {
	public boolean clicked;
	public boolean pressed;

	////////////////////////////////////////////////////////////////////////////////////////////////////
	public PlusButton(String label)
	{
		super();
		width=15;
		height=15;
		this.label = label;
	}
	public void draw()
	{
		GV.processing.textFont(GV.plotFont, 14);
		GV.processing.stroke(128);
		GV.processing.fill(GV.textColor);	
		GV.processing.textAlign(GV.processing.LEFT);
		GV.processing.text(label, x - GV.processing.textWidth(label) -10, y+10 );
		if(!clicked){
		GV.processing.line(x+width/2, y, x+width/2, y+height);
		GV.processing.line(x, y+height/2, x+width, y+height/2);
		}
		else{
			GV.processing.line(x, y+height/2, x+width, y+height/2);
		}
		int cx = x;
		int cy = y;

		GV.processing.textAlign(GV.processing.LEFT);

		if(mouseOver()) 
		{
			super.draw();
			if(GV.processing.mousePressed)
			{
				//gu.drawVGradient(x, y + height, width, -height, color(150, 150, 180), 80, color(150, 150, 180), 255, 0.8);    
				GV.gu.drawBox(x, y, width, height, 0, GV.processing.color(150, 150, 200), 255);
				GV.gu.drawBox(x, y, width, height, 1, GV.processing.color(150, 150, 200), 150);
                pressed = true;

				cx += 2;
				cy += 2;
			}
			else if(pressed)
            {
                pressed = false;
                if(!clicked){clicked = true;}
                else clicked = false;
            }
        }
        else
        {
            pressed = false;
        }

	}

	////////////////////////////////////////////////////////////////////////////////////////////////////
	String label;


}
